package com.tjetc.usermanage;

import com.tjetc.domian.Propertyservice;
import com.tjetc.proxy.ClientProxy;
import com.tjetc.service.ServiceService;

import java.util.List;
import java.util.Scanner;

public class ServiceView {
    private static  Scanner scanner = new Scanner(System.in);
    private ServiceService serviceService=ClientProxy.getProxyInstance(ServiceService.class);
    public void start() {
        while (true) {
            System.out.println("物业服务菜单");
            System.out.println("1.查询服务信息");
            System.out.println("0.返回上一级");
            int i = scanner.nextInt();
            switch (i) {
                case 1:
                    select();
                    break;
                case 0:
                    return;
            }
        }
    }

    private void select() {
        List<Propertyservice> list = serviceService.select();
        if (list == null){
            System.out.println("没有数据");
        }else{
            for (Propertyservice propertyservice : list) {
                System.out.println(propertyservice);
            }
        }
    }
}
